Skip to content

feat(CDA): Add asset localisation support#154

Open
OMpawar-21 wants to merge 1 commit intodevelopmentfrom
enhc/DX-4448
Open

feat(CDA): Add asset localisation support#154
OMpawar-21 wants to merge 1 commit intodevelopmentfrom
enhc/DX-4448

Conversation

@OMpawar-21
Copy link

PR: Asset localisation support

Summary

Adds asset localisation to the .NET CDA SDK: request assets by locale and read localised title from the response.

Code changes

File Change
Contentstack.Core/Models/Asset.cs Added Title property ([JsonProperty("title")]). Added SetLocale(string locale) for single-asset fetch by locale.
Contentstack.Core/Models/AssetLibrary.cs No change (existing SetLocale already supports list-by-locale).
CHANGELOG.md Documented under v2.26.0.

Test cases added

Unit (AssetLibraryUnitTests.cs)

  • SetLocale_ForAssetLocalisation_AddsLocaleQueryParameterSetLocale("ar") adds locale to query.
  • SetLocale_UpdatesLocaleWhenCalledAgain – second SetLocale overwrites the first.

Unit (AssetUnitTests.cs)

  • SetLocale_AddsQueryParameterAsset.SetLocale("en-us") adds locale.
  • AddParam_WithLocale_AddsLocaleQueryParameterAddParam("locale", "ar") adds locale.
  • AddParam_LocaleWithIncludeFallback_AddsBothQueryParameters – locale + IncludeFallback().

Integration (AssetTest.cs)

  • FetchAssetsWithLocale_ReturnsLocalisedAssets – list with SetLocale("en-us").
  • FetchSingleAssetWithLocale_ReturnsLocalisedAsset – single asset via AddParam("locale", ...).
  • FetchSingleAssetWithSetLocale_ReturnsLocalisedAsset – single asset via SetLocale(...).
  • FetchAssetsWithLocaleAr_ReturnsAssetsWithLocale – list with SetLocale("ar").
  • FetchAssetsWithLocaleAndFallback_ReturnsLocalisedOrFallback – locale + IncludeFallback().

Backward compatibility

Additive only; no breaking changes.

Add SetLocale on Asset for single-asset fetch, Title property for localised
title; AssetLibrary SetLocale unchanged. Add unit and integration tests; update CHANGELOG for 2.26.0.
@OMpawar-21 OMpawar-21 requested a review from a team as a code owner February 17, 2026 10:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

Comments